﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace KoshiDE
{
    public class KoshiSolution
    {
        private Dictionary<double, double> table = new Dictionary<double, double>();
        public int Length 
        { 
            get 
            { 
                return this.table.Count(); 
            } 
        }
        public double[] Points
        {
            get
            {
                return this.table.Keys.ToArray();
            }
        }

        public KoshiSolution(Dictionary<double, double> table)
        {
            this.table = table;
        }

        public KoshiSolution()
        {
        }

        public double this[double point]
        {
            get
            {
                if (this.table.ContainsKey(point))
                {
                    return this.table[point];
                }
                else
                {
                    throw new PointNotFoundException();
                }
            }
            set
            {
                if (this.table.ContainsKey(point))
                {
                    this.table[point] = value;
                }
                else
                {
                    this.table.Add(point, value);
                }
            }
        }
    }
}
